package com.headfirst.StructuralMode.decorator.version0.version01;

/**
 * 所有饮料的抽象类（被装饰的对象,可以由具体的装饰者对象进行装饰，即：在具体的饮料中添加不同的调料）
 * @author sunhongguang
 * @create 2022-01-22-20:27
 */
public abstract class Beverage {

    /**
     * 饮料的描述信息
     */
    private String description = "Unknown Beverage";

    private boolean milk;
    private boolean soy;

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public boolean isMilk() {
        return milk;
    }

    public void setMilk(boolean milk) {
        this.milk = milk;
    }

    public boolean isSoy() {
        return soy;
    }

    public void setSoy(boolean soy) {
        this.soy = soy;
    }

    public double cost(){
        double condimentCost = 0.0;
        if(isMilk()){
            condimentCost += 1;
        }
        if(isSoy()){
            condimentCost += 2;
        }
        return condimentCost;
    }
}
